#pragma once

#include "hugin"
#include <map>
#include <list>
#include <hash_map>
#include <iostream>

using namespace std;
using namespace stdext;

class PolicyFileParser
{
public:	
	PolicyFileParser::PolicyFileParser();
	PolicyFileParser::PolicyFileParser(string actionPrefix, string observationPrefix, string policyFiles, string fileExtension, bool preloadFiles);
	string  DecisionFromObservation(int timeStep, string observation);

	int PolicyFileParser::GetNumberOfFilesInFolder(string folderDir, string fileExtension);

private:
	string _actionPrefix;
	string _observationPrefix;
	string _policyFilesDir;
	string _fileExtension;
	hash_map<string, string> _previousActObs;
	hash_map<string, hash_map<string, list<string>>> _policies;
	hash_map<string, list<string>> _parents;
	void PolicyFileParser::StoreAction(int timeStep, string action);
	void PolicyFileParser::StoreObservation(int timeStep, string observation);
	list<string> PolicyFileParser::ParseTextFile(string inputFile);
	list<string> PolicyFileParser::GetParentNamesFromFile(list<string> inputStrings);
	string PolicyFileParser::GetCSVSearchString(list<string> parents);
	string PolicyFileParser::GetActionNodeFileNameFromTimeStep(int timeStep);
	string PolicyFileParser::GetFullStringFromSearchString(string searchString, list<string> lines);
	list<string> PolicyFileParser::GetActionsFromLine(int numParents, string line);
	string PolicyFileParser::GetActionFromList(list<string> actions);
	list<string> PolicyFileParser::GetPolicyList(list<string> inputStrings);
	void PolicyFileParser::PreloadedFiles();
};

